// run: $exec < input
#include <cstdio>
#include <algorithm>

int const maxn = 130100;
int n, m;

class splay_tree
{
	struct node
	{
		node() { child[0] = child[1] = parent = NULL; }

		void set_child(node * c, bool is_right)
		{
			child[is_right] = c;
			c->parent = this;
			c->is_right = is_right;
		}

		int key, size;
		bool rev; // interval reverse flag
		bool is_right;
		node * child[2], * parent;
	} * root, * null, memory[maxn], * alloc = memory;

	void update(node * t)
	{
		t->size = t->child[0]->size + t->child[1]->size + 1;
	}

	node * new_node(int key)
	{
		alloc->child[0] = alloc->child[1] = null;
		alloc->rev = false;
		alloc->size = 1;
		alloc->key = key;
		return alloc++;
	}

	void reverse(node * t)
	{
		if (t == null) return;
		t->rev ^= 1;
		std::swap(t->child[0], t->child[1]);
		t->child[0]->is_right = false;
		t->child[1]->is_right = true;
	}

	void push_down(node * t)
	{
		if (t->rev) {
			reverse(t->child[0]);
			reverse(t->child[1]);
		}
		t->rev = false;
	}

	void rot(node * t)
	{
		node * p = t->parent;
		push_down(p);
		push_down(t);
		bool ir = t->is_right;
		p->set_child(t->child[!ir], ir);
		p->parent->set_child(t, p->is_right);
		t->set_child(p, !ir);
		update(p);
		update(t);
		if (p == root) root = t;
	}

	void splay(node * t, node * f)
	{
		// for (push_down(t); t->parent != f; ) {
		for (; t->parent != f; ) { // no need push down. ac.
			if (t->parent->parent == f)
				rot(t);
			else
				t->is_right == t->parent->is_right ? (rot(t->parent), rot(t)) : (rot(t), rot(t));
		}
	}

	node * sel(int k)
	{
		for (node * t = root; ; ){
			push_down(t);
			int tmp = t->child[0]->size;
			if (tmp == k) return t;
			t = t->child[k > tmp];
			if (k > tmp) k -= tmp + 1;
		}
	}

public:
	splay_tree(int n)
	{
		null = new node; null->size = 0;
		root = new_node(0); root->parent = null;
		node * p, * q = root;
		for (int i = 1; i <= n; i++) {
			p = new_node(i);
			q->set_child(p, true);
			q = p;
		}
		node * last = new_node(0);
		q->set_child(last, true);
		splay(last, null);
	}

	node* get_root()
	{
		return root;
	}

	void reverse(int l, int r)
	{
		node * x, * y;
		x = sel(l - 1);
		splay(x, null);
		y = sel(r + 1);
		splay(y, root);
		reverse(y->child[0]);
	}

	void print(node * t)
	{
		if (t == null || !t) return;
		push_down(t);
		print(t->child[0]);
		if (t->key) std::printf("%d ", t->key);
		print(t->child[1]);
	}
};

int main()
{
	int n, m;
	std::scanf("%d %d", &n, &m);
//	splay_tree::init(n);
	splay_tree sp(n);
	for (int l, r; m--; ) {
		std::scanf("%d %d", &l, &r);
		sp.reverse(l, r);
	}
	sp.print(sp.get_root());
}

